db.createUser({
    user: 'myUserAdmin',
    pwd: '123456',
    roles: [{role: 'userAdminAnyDatabase', db: 'test'}, {role: 'readWriteAnyDatabase', db: 'test'}]
})

db.artists.aggregate([
    {
        $bucket: {
            groupBy: "$year_born",                        // Field to group by
            boundaries: [1840, 1850, 1860, 1870, 1880], // Boundaries for the buckets
            default: "Other",                             // Bucket ID for documents which do not fall into a bucket
            output: {                                     // Output for each bucket
                "count": {$sum: 1},
                "artists":
                    {
                        $push: {
                            "name": {$concat: ["$first_name", " ", "$last_name"]},
                            "year_born": "$year_born"
                        }
                    }
            }
        }
    },
    {
        $match: {count: {$gt: 3}}
    }
])